// 入口文件
//导入elementui
import Vue from 'vue'
//安装vue-router
import VueRouter from 'vue-router'

Vue.use(VueRouter);

//引入vuex
import Vuex from 'vuex'
Vue.use(Vuex)
var store = new Vuex.Store({
    state: { //this.$store.state.***
        task: [],
        loginP:[]
    },
    mutations: {//this.$store.commit('方法的名称', '按需传递唯一的参数')
        add_task(state, taskinfor) {//获取task传的参数
            state.task = taskinfor;
        },

    },
    getters: { // this.$store.getters.***
        get_task(state) {
            console.log(state.task);
            return state.task;
        }
    }

})

//格式化事件插件
import moment from 'moment';

//定义全局过滤器
Vue.filter('dateFormat', function (dataStr, pattern = 'YYYY-MM-DD HH:mm:ss') {
    moment(dataStr).format(pattern);
})
import VueResource from 'vue-resource'

Vue.use(VueResource);
// 设置请求的根路径
Vue.http.options.root = 'http://api.zankong.com.cn:9998';
//导入MUI样式
import './lib/mui/css/mui.min.css'
//按需要导入mint-ui中的组件
import {
    Header,
    Swipe,
    SwipeItem
} from 'mint-ui';

Vue.component(Header.name, Header);
Vue.component(Swipe.name, Swipe);
Vue.component(SwipeItem.name, SwipeItem);
//导入router
import router from "./router.js"
import app from './APP.vue'
import ElementUI from 'element-ui' //新添加
import 'element-ui/lib/theme-chalk/index.css' //新添加，避免后期打包样式不同，要放在import App from './App';之前
Vue.use(ElementUI) //新添加

var vm = new Vue({
    el: "#app",
    render: c => c(app),
    router,
    store
})
